﻿using System;


namespace FireBus.Core
{
	public class GenericAsyncResult<TResult> : VoidAsyncResult
	{
		private TResult _Result;

		public GenericAsyncResult(AsyncCallback asyncCallback, Object state, IMessageAccessor messageAccessor)
			: base(asyncCallback, state, messageAccessor)
		{
		}

		public void SetAsCompleted(
			TResult result, Boolean completedSynchronously)
		{
			_Result = result;
			SetAsCompleted(null, completedSynchronously);
		}

		new public TResult EndInvoke()
		{
			base.EndInvoke();
			return _Result;
		}
	}
}
